<include file="Public:header" />
<!-- nice-scroll -->
<script src="__PUBLIC__/style/js/plugins/nice-scroll/jquery.nicescroll.min.js" type="text/javascript"></script>
<script type="text/javascript" src="__PUBLIC__/style/js/TableFreeze.js"></script>
<script src="__PUBLIC__/js/mxcrm_more.js" type="text/javascript"></script>
<style>
	body{
		overflow-y: hidden;
	}
	.option{padding-left:-30px;}
	#right-sidebar-log{
		width: 50% !important;
		right: -60%;
		background-color: #fff;
	    overflow: hidden;
	    position: fixed;
	    top: 60px;
	    z-index: 1009;
	    bottom: 0;
	    box-shadow: 0px 2px 1px #888888;
	}
</style>
<script>
$(function(){
	var scroll_width = 10;
	$("#table_div").height(window.innerHeight-$("#table_div").offset().top-$("#tfoot_div").height()-parseInt($("#table_container").css("padding-bottom").replace("px",""))-10);
	$(window).resize(function(){
		$("#table_div").height(window.innerHeight-$("#table_div").offset().top-$("#tfoot_div").height()-parseInt($("#table_container").css("padding-bottom").replace("px",""))-10);
		$("#oDivL_tab_Test3").height($("#table_div").height()-scroll_width-1).width($("#oTableLH_tab_Test3").width());
		$("#oDivH_tab_Test3").height($("#oTableLH_tab_Test3").height()).width($("#table_div").width()-scroll_width);
	});
	$(".nicescroll").niceScroll({
		cursorcolor: "#999",//#CC0071 光标颜色 
	    cursoropacitymax: 0.4, //改变不透明度非常光标处于活动状态（scrollabar“可见”状态），范围从1到0 
	    touchbehavior: false, //使光标拖动滚动像在台式电脑触摸设备 
	    cursorwidth: scroll_width+"px", //像素光标的宽度 
	    cursorborder: "0", //     游标边框css定义 
	    cursorborderradius: "3px",//以像素为光标边界半径 
	    autohidemode: false, //是否隐藏滚动条 
	    zindex:100,
	    background:"#F3F3F5",//滚动条背景色
	});
	$("#tab_Test3").FrozenTable(1,0,3);
	$("#oDivL_tab_Test3").height($("#table_div").height()-scroll_width).width($("#oTableLH_tab_Test3").width());
	$("#oDivH_tab_Test3").height($("#oTableLH_tab_Test3").height()).width($("#table_div").width()-scroll_width);
	//$("#oDivH_tab_Test3").css('top','-7px');
})
</script>
<div class="wrapper wrapper-content">
	<include file="Public:alert" />
    <div class="row">
        <div class="col-md-12">
            <div class="ibox float-e-margins">
				<div class="title-bar" style="position: relative;z-index: 99;">
					<div class="row  clearfix" id="title-hide" style="display:none;">
						<ul class="breadcrum pull-left">
							<li>已选中&nbsp;<span id="icheck_num"></span>&nbsp;项</li>
							<li class="single_btn"><a href="javascript:void(0)" id="edit_log"><i class="fa fa-pencil"></i>&nbsp;编辑</a></li>
							<li><a id="delete" href="javascript:void(0)"><i class="fa fa-times"></i>&nbsp;删除</a></li>
							<li class="last_li"><big><a class="fa fa-times pull-right" id="back-show"></a></big></li>
						</ul>
					</div>
					<div class="row " id="title-show">
						<ul class="nav pull-left" style="margin:2px 0 0 15px;">
							<a href="{:U('log/mylog_add')}" class="btn btn-primary btn-sm pull-left" style="margin-right:8px"><i class="fa fa-plus-circle"></i>&nbsp; 新建日报</a>
						</ul>
						<form class="form-inline" id="" action="" method="get">
							<ul class="breadcrum pull-right" style="margin-bottom: 0px">
								<li>
									搜索员工：
									<select class="form-control select2" name="role_id" id="role_id" onchange="window.open(this.options[this.selectedIndex].value,target='_self')">
										<option value="">--请选择--</option>
										<volist name="role_list" id="vo">
											<option value="{:U('log/index','&role_id='.$vo['role_id'].'&'.$parameter)}" <if condition = "$_GET['role_id'] eq $vo['role_id']">selected</if>>{$vo['full_name']}</option>
										</volist>	
									</select>
									<div class="input-group" style="margin-left: 10px;">
										<select class="form-control" onchange="window.open(this.options[this.selectedIndex].value,target='_self')" >
											<option value="{:U('log/index')}" <if condition = "$_GET['type'] eq ''">selected="selected"</if>>全部</option>
											<option value="{:U('log/index','type=4')}" <if condition = "$_GET['type'] eq 4">selected="selected"</if>>日报</option>
											<option value="{:U('log/index','type=3')}" <if condition = "$_GET['type'] eq 3">selected="selected"</if>>周报</option>
											<option value="{:U('log/index','type=2')}" <if condition = "$_GET['type'] eq 2">selected="selected"</if>>月报</option>
										</select>
									</div>
								</li>
							</ul>
						</form>
					</div>
				</div>
				<div class="row" style="margin: 0px">
					<div class="ibox-content" style="padding:0px;">
						<div class="ibox-content clearfix" id="table_container" style="padding:0px;border: none;z-index: 1;">
							<input type="hidden" id="is_show" value="0"/>
							<form id="form1" action="" method="Post" style="position:relative;"> 
								<div id="table_div" class="nicescroll" style="left:0px;top:0px;">
								<if condition="$list eq null">
									<div style="background-color:#fff;"><include file="Public:nodata" /></div>
								<else/>
									<table class="table table-hover table-striped table_thead_fixed" id="tab_Test3">
										<tr class="tabTh" >
											<td style="width:80px;">
												<div class="checkbox checkbox-primary">
													<input type="checkbox" class="check_all"/>
													<label for=""></label>
												</div>
											</td>
											<td>{:L('SUBJECT')}</td>
											<td>{:L('ROLE_NAME')}</td>
											<td>类型</td>
											<td>附件</td>
											<td>概要</td>
											<td>点评状态</td>
											<td>
												<if condition="$_GET['desc_order'] == 'create_date'">
													<a href="{:U('log/index','asc_order=create_date&'.$parameter)}" title="点击按时间正序排列">
														{:L('CREATE_TIME')}&nbsp;<span class="fa fa-caret-down"></span>
													</a>
												<elseif condition="$_GET['asc_order'] == 'create_date'"/>
													<a href="{:U('log/index','desc_order=create_date&'.$parameter)}"  title="点击按时间倒序排列">
														{:L('CREATE_TIME')}&nbsp;<span class="fa fa-caret-up"></span>
													</a>
												<else/>
													<a href="{:U('log/index','asc_order=create_date&'.$parameter)}" title="点击按时间正序排列">{:L('CREATE_TIME')}&nbsp;<span class="fa fa-caret-down"></a>
												</if>
											</td>
										</tr>
										<volist name="list" id="vo">
											<tr class="controls_tr">
												<td style="width:80px;">
													<div class="checkbox checkbox-primary">
														<input name="log_id[]" class="check_list" type="checkbox" value="{$vo.log_id}"/>
														<label for=""></label>
													</div>
												</td>
												<td>
													<a class="right-sidebar-toggle-log" href="javascript:void(0)" rel="{$vo['log_id']}">
														<if condition="$vo['subject'] ">
															{$vo.subject}
														<else />
															{$vo['content']|msubstr=###,0,15}
														</if>
													</a>
												</td>
												<td>
													<notempty name="vo.creator.user_name">
														<a class="role_info" rel="{$vo.creator.role_id}" href="javascript:void(0)">{$vo.creator.full_name}</a>
													</notempty>
												</td>
												<td>{$vo['category_name']}</td>
												<td class="">
													<if condition = "$vo['file_count']">
														<i class="fa fa-paperclip"></i>&nbsp;({$vo['file_count']})
													</if>
												</td>
												<td>{$vo['content']|msubstr=###,0,35}</td>
												<td>
													<if condition = "$vo['status'] eq 2" >
														<span style="border: 1px solid #00D842;padding: 2px 10px;border-radius: 10px;color:#00D842;">已点评</span>
													<else />
														<span style="border: 1px solid #FFA856;padding: 2px 10px;border-radius: 10px;color:#FFA856;">未点评</span>
													</if>
												</td>
												<td>{$vo.create_date|date="Y-m-d H:i",###}</td>
											</tr>
										</volist>
									</table>
								</if>
								</div>
								<div id="tfoot_div" class="clearfix">
									<div class="clearfix" id="tfoot_page">				
										{$page}<include file="Public:listrows" />
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
    		</div>
        </div>
    </div>
</div>
<link href="__PUBLIC__/css/litebox.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC__/js/litebox.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/js/images-loaded.min.js" type="text/javascript"></script>

<div style="display:none;" id="dialog-role-info" title="{:L('DIALOG_USER_INFO')}">
	<div class="spiner-example">
		<div class="sk-spinner sk-spinner-three-bounce">
			<div class="sk-bounce1"></div>
			<div class="sk-bounce2"></div>
			<div class="sk-bounce3"></div>
		</div>
	</div>
</div>
<script type="text/javascript">
/*让复选框默认取消选择*/
$(':checkbox').prop('checked', false);
$("#dialog-role-info").dialog({
    autoOpen: false,
    modal: true,
	width: 600,
	maxHeight: 550,
	position: ["center",100]
});
$(function(){
	$('#delete').click(function(){
		var id_array = new Array();
		$("input.check_list:checked").each(function(){  
			id_array.push($(this).val());
		});
		if(id_array.length == 0){
			alert_crm('您没有选中任何日志！');
			return false;
		}
		swal({
			title: "您确定要删除日志信息吗？",
   			text: "删除后将无法恢复，请谨慎操作！",
			type: "warning",   
			showCancelButton: true,   
			confirmButtonColor: "#DD6B55",   
			confirmButtonText: "是的，我要删除！",
	        cancelButtonText:'让我再考虑一下…',
	        closeOnConfirm:false,
	        closeOnCancel:false
		},
		function(isConfirm){
	        if (isConfirm) {
	        	$.ajax({
		            type:'post',
		            url: "{:U('log/log_delete')}",
		            data: {log_id: id_array},
		            async: false,
		            success: function (data) {
						if (data.status == 1) {
							swal("删除成功！", "您已经永久删除了信息！", "success");
							location.reload();
						}else{
							swal({
								title: "操作失败！",
								text:data.info,
								type: "error"
							})
							return false;
						}
		            },
		            dataType: 'json'
		        });
	        } else {
	            swal("已取消","您取消了删除操作！","error");
	        }
	    });
	});

	$(".role_info").click(function(){
		$role_id = $(this).attr('rel');
		$('#dialog-role-info').dialog('open');
		$('#dialog-role-info').load('{:U("user/dialoginfo","id=")}'+$role_id);
	});
})
function changeContent(){
	$module = $('#module').val();
	if($module == 6){
		window.location = "{:U('Log/index','by='.$_GET['by'].'&type=4')}";
	}else if($module == 1){
		window.location = "{:U('Log/index','r=rCustomerLog&module=customer&by='.$_GET['by'].'&type=1')}";
	}else if($module == 2){
		window.location = "{:U('Log/index','r=rContactsLog&module=contacts&by='.$_GET['by'].'&type=1')}";
	}else if($module == 3){
		window.location = "{:U('Log/index','r=rBusinessLog&module=business&by='.$_GET['by'].'&type=1')}";
	}else if($module == 4){
		window.location = "{:U('Log/index','r=rLogTask&module=task&by='.$_GET['by'].'&type=1')}";
	}else if($module == 5){
		window.location = "{:U('Log/index','r=rEventLog&module=event&by='.$_GET['by'].'&type=1')}";
	}
}
<if condition="$Think.get.field neq null">
	$("#field option[value='{$Think.get.field}']").prop("selected", true);changeCondition();
	$("#condition option[value='{$Think.get.condition}']").prop("selected", true);changeSearch();
	$("#search").prop('value', '{$Think.get.search}');
</if>
</script>

<script>
	$(function(){
		$("#edit_log").click(function(){
			window.location.href="{:U('log/mylog_edit','&id=')}"+$(this).attr('rel');
		})
	});
	/*日志详情 加载的圈圈效果*/
	var detail_html = '<div class="spiner-example">\
						<div class="sk-spinner sk-spinner-fading-circle">\
							<div class="sk-circle1 sk-circle"></div>\
							<div class="sk-circle2 sk-circle"></div>\
							<div class="sk-circle3 sk-circle"></div>\
							<div class="sk-circle4 sk-circle"></div>\
							<div class="sk-circle5 sk-circle"></div>\
							<div class="sk-circle6 sk-circle"></div>\
							<div class="sk-circle7 sk-circle"></div>\
							<div class="sk-circle8 sk-circle"></div>\
							<div class="sk-circle9 sk-circle"></div>\
							<div class="sk-circle10 sk-circle"></div>\
							<div class="sk-circle11 sk-circle"></div>\
							<div class="sk-circle12 sk-circle"></div>\
						</div>\
					</div>';

	//鼠标点击空白处，隐藏右侧滑出
	document.onmousedown=function(event){
		if($(".litebox-overlay").length > 0) return;
		if(event.target.className == 'right-sidebar-toggle-log') return;

	    var div = document.getElementById("right-sidebar-log");
	    var x=event.clientX;
	    var y=event.clientY;
	    var divx1 = div.offsetLeft;
	    var divy1 = div.offsetTop;
	    var divx2 = div.offsetLeft + div.offsetWidth;
	    var divy2 = div.offsetTop + div.offsetHeight;
	    if( x < divx1 || x > divx2 || y < divy1 || y > divy2){
	        if($("#right-sidebar-log").css('right') == '0px'){
	            $("#right-sidebar-log").animate({right:'-60%'}, 400);
	            //$('#is_show').val('0');
	        }
	    }
	}
	//日志详情弹出
	$(document).on('click','.right-sidebar-toggle-log',function(){
		var log_id = $(this).attr('rel');
		// var is_show = document.getElementById("is_show").value;
		$(".emoji_container").remove();


        $(".check_all").attr("checked",false);
		$('input[name="log_id[]"]').each(function(){
            if ($(this).val() == log_id && $(this).is(":checked") == false) {
				$(this).click();
			} else if ($(this).val() != log_id && $(this).is(":checked")){
                $(this).click();
            }
		}); 

		if($("#right-sidebar-log").css('right') != '0px'){
			$("#right-sidebar-log").animate({right:'0px'}, 600);
		}
			
	    $('#log-content').html(detail_html);
	    $('#sidebar-container').load("{:U('log/viewAjax','log_id=')}"+log_id);
		
	});
	
</script>
<include file="Public:footer" />
<div id="right-sidebar-log">
	<!--the css for jquery.mCustomScrollbar-->
	<link rel="stylesheet" href="__PUBLIC__/emoji/css/jquery.mCustomScrollbar.min.css"/>
	<!--the css for this plugin-->
	<link rel="stylesheet" href="__PUBLIC__/emoji/css/jquery.emoji.css"/>
	<!--(Optional) the js for jquery.mCustomScrollbar's addon-->
	<script src="__PUBLIC__/emoji/js/jquery.mousewheel-3.0.6.min.js"></script>
	<!--the js for jquery.mCustomScrollbar-->
	<script src="__PUBLIC__/emoji/js/jquery.mCustomScrollbar.min.js"></script>
	<!--the js for this plugin-->
	<script src="__PUBLIC__/emoji/js/jquery.emoji.js"></script>

	<div class="sidebar-container" id="sidebar-container">
		
	</div>
</div>
